package com.aj.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

import com.aj.sharepreferences.LoveHomeSharedPreferences;
import com.aj.utils.Contants;

public class SafeActivity extends BaseActivity {
	private TextView updatepassword;
	private TextView update_gesturepassword;

	public static SafeActivity intances;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_private_safe);
		intances = this;
		initView();
	}

	private void initView() {
		updatepassword = (TextView) findViewById(R.id.updatepassword);
		update_gesturepassword = (TextView) findViewById(R.id.update_gesturepassword);
		ButtonClient buttonClient = new ButtonClient();
		updatepassword.setOnClickListener(buttonClient);
		update_gesturepassword.setOnClickListener(buttonClient);
		setActionBarTitle(R.string.home_safe_text);
	}

	class ButtonClient implements OnClickListener {
		@Override
		public void onClick(View v) {
			Intent intent = null;
			switch (v.getId()) {
			case R.id.updatepassword:
				intent = new Intent(Contants.UPDATEPASSWORD_ACTIVITY_ACTION);
				startActivity(intent);
				break;
			case R.id.update_gesturepassword:
				if (LoveHomeSharedPreferences.getGesturePassowrd().trim()
						.equals("")) {
					intent = new Intent(Contants.NEWGESTURE_ACTIVITY_ACTION);
				} else {
					intent = new Intent(
							Contants.GESTUREPASSWORD_ACTIVITY_ACTION);
				}
				startActivity(intent);
				break;
			}
		}
	}
}
